package gui.entity;

import generated.domain.avatar.Avatar;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;

public class AvatarElementPropertySource implements IPropertySource {

	private static final String PROPERTY_ID_NAME = "avatar.name";
	private static final Object PROPERTY_ID_MOOD = "avatar.mood";
	private static final Object PROPERTY_ID_GENDER = "avatar.gender";
	private static final Object PROPERTY_ID_SIZE = "avatar.size";
	private final Avatar avatar;

	private IPropertyDescriptor[] propertyDescriptors;

	public AvatarElementPropertySource(AvatarEntity element) {
		avatar = element.getAvatar();
	}

	public IPropertyDescriptor[] getPropertyDescriptors() {
		if (propertyDescriptors == null) {
			PropertyDescriptor nameDescriptor = new PropertyDescriptor(
					PROPERTY_ID_NAME, "Name");

			PropertyDescriptor moodDescriptor = new PropertyDescriptor(
					PROPERTY_ID_MOOD, "Mood");

			PropertyDescriptor genderDescriptor = new PropertyDescriptor(
					PROPERTY_ID_GENDER, "Gender");

			PropertyDescriptor sizeDescriptor = new PropertyDescriptor(
					PROPERTY_ID_SIZE, "Size");

			propertyDescriptors = new IPropertyDescriptor[] { nameDescriptor,
					moodDescriptor, genderDescriptor, sizeDescriptor };
		}
		return propertyDescriptors;
	}

	public Object getEditableValue() {
		// TODO Auto-generated method stub
		return null;
	}

	public Object getPropertyValue(Object id) {
		if (id.equals(PROPERTY_ID_NAME))
			return avatar.name;
		if (id.equals(PROPERTY_ID_MOOD))
			return avatar.mood;
		if (id.equals(PROPERTY_ID_GENDER))
			return avatar.gender;
		if (id.equals(PROPERTY_ID_SIZE))
			return avatar.size;
		return "";
	}

	public boolean isPropertySet(Object id) {
		// TODO Auto-generated method stub
		return false;
	}

	public void resetPropertyValue(Object id) {
		// TODO Auto-generated method stub

	}

	public void setPropertyValue(Object id, Object value) {
		// TODO Auto-generated method stub

	}
}